package exception;

import java.io.FileOutputStream;

/**
 * JDK1.7后推出的特性：自动关闭特性
 */
public class AutoCloseableDemo {
    public static void main(String[] args) {
        try(
                FileOutputStream fos = new FileOutputStream("./a/b/a.txt")
        ) {
            fos.write(2);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
